<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="hexinyang">		
		<title>挂失</title>
		<!--js库及样式-->
		<script language="javascript" type="text/javascript" src="../script/print.js"></script>
		<script language="javascript" type="text/javascript" src="../script/card.js"></script>
		<script language="javascript" src="../script/common.js" type="text/javascript"></script>	
		<script language="javascript" type="text/javascript">
			//页面加载方法	
			function load(){			
				Eui.showNavigation();
				setPages(["searchView","detview"]);
				Rpc.loadPage("formDetail","card_detail_div.html");
			}
			//挂失方法
			function doLock(){
				var asn = detailForm.asn.value;
				if(showQuestion("是否挂失卡片：<br>【"+asn+"】?")){
					if(searchForm.checkType[0].checked){
						if (!showQuestion("请插入主卡后点击确定核对客户身份，或取消返回。")) return;
						try{
							var msg = "当前主卡和预挂失副卡不匹配！"
							CardMgnt.checkMasterCard(detailForm.companyUserId.value,msg);
						}catch(e){showError(e.description);return;}
					}
					DWR.call("blacklistService.reportLostCard",asn,function(v){	
						showInformation("卡片"+asn+"挂失成功");
						CardMgnt.showPrintView("detview","lockCard_bill",v.logId,"挂失凭证");
						switchPage("detview");
					},{blockScreen : true});
				}
			}
			//查询显示信息明细
			function searchCard(){
				if(!checkForm(searchForm))return;			
				var asn = searchForm.cardNumber.value;
				DWR.call("mgntQueryService.checkCardLock",asn,function(data){
					var cardObj = CardMgnt.convertCardObject(data);
					Common.setValues(detailForm,cardObj);
					detailForm.lockBtn.disabled = false;
					detailForm.selBtn.disabled = true;
					searchForm.cardNumber.readOnly = true;
					searchForm.cardNumber.className = "readonly";
					if (data.companyUserId){				//有单位帐户信息为司机卡挂失
						$("radio1").style.display = "";
						searchForm.checkType[0].checked = true;
					}
				},{blockScreen : true});
			}
			
			//返回方法
			function onCancel(){
				CardMgnt.resetForm(searchForm)
				detailForm.reset();
				detailForm.selBtn.disabled = false;
				searchForm.cardNumber.readOnly = false;
				searchForm.cardNumber.className = "";
				detailForm.lockBtn.disabled = true;
				$("radio1").style.display = "none";
				searchForm.checkType[1].checked = true;
				switchPage("searchView");
			}
		</script>
	</head>
	<body onload="load()">
		<!--页面导航-->
		<div class="nav"><div id="nav">&nbsp;</div>
		</div>
		<div id="searchView">
			<div class="form">
				<div class="formTitle">输入卡号</div>
				<form name="searchForm" id="searchForm">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label5">
							<tr>
								<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> <input type="text" name="cardNumber" onBlur="checkV(this,'asn',true)"><span class="des">*</span></td>
								<td><label>帐户校验</label> <span id="radio1" style="display:none;"><input type="radio" name="checkType" value="1">
								使用主卡 </span><input checked type="radio" name="checkType" value="2">使用证件<span class=red>（请在查询后核对客户帐户信息）</span></td>
							</tr>
					</table>
				</form>
			</div>
			
			<form id="detailForm" name="detailForm">
				<input type="hidden" name="companyUserId">
				<div class="form">
					<div class="formTitle">卡片明细信息</div>
					<div id="formDetail"></div>
				</div>
				<p>
					<button type="button" name="selBtn" onclick="searchCard()">查 询</button>
					<button type="button" name="lockBtn" onclick="doLock()" disabled>挂 失</button>
					<button type="button" name="resBtn" onclick="onCancel()">重 置</button>
				</p>
			</form>
		</div>
	
		<div id="detview" style="display:none;">
		</div>
	</body>
</html>